package com.jiang.smartdangjian.ui.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.jiang.smartdangjian.R;
import com.jiang.smartdangjian.tool.MyAdapter;

import java.util.Arrays;

public class S3Activity extends BaseActivity implements View.OnClickListener {
    private RecyclerView rv;
    private FloatingActionButton floatingActionButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_s3);
        setTitle("建言献策");
        initView();
    }

    private void initView() {
        rv = (RecyclerView) findViewById(R.id.rv);
        floatingActionButton = (FloatingActionButton) findViewById(R.id.floatingActionButton);

        floatingActionButton.setOnClickListener(this);
        rv.setLayoutManager(new LinearLayoutManager(getThis()));
        rv.setAdapter(new MyAdapter<Integer>(getThis(), R.layout.item_s3, Arrays.asList(R.drawable.x1, R.drawable.x2, R.drawable.x3)) {
            private CardView cardView2;
            private ImageView imageView15;
            private CardView cardView3;
            private ImageView imageView16;
            private TextView textView35;
            private TextView textView36;
            private TextView textView37;

            @Override
            public void init(View root, int position) {
                cardView2 = (CardView) root.findViewById(R.id.cardView2);
                imageView15 = (ImageView) root.findViewById(R.id.imageView15);
                cardView3 = (CardView) root.findViewById(R.id.cardView3);
                imageView16 = (ImageView) root.findViewById(R.id.imageView16);
                textView35 = (TextView) root.findViewById(R.id.textView35);
                textView36 = (TextView) root.findViewById(R.id.textView36);
                textView37 = (TextView) root.findViewById(R.id.textView37);
                imageView15.setImageResource(list.get(position));
            }
        });
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.floatingActionButton:
                startActivity(new Intent(this, S3DActivity.class));
                break;
        }
    }
}